/*
 * Copyright (c) 2010 Curtis Boyden.  All rights reserved. 
 * This software was developed by Curtis Boyden and is provided under the terms 
 * of the GNU Lesser General Public License, Version 2.1. You may not use 
 * this file except in compliance with the license. If you need a copy of the license, 
 * please go to http://www.gnu.org/licenses/lgpl-2.1.txt. The Original Code is ejMud
 * (Ewerp Java MUD).  The Initial Developer is Curtis Boyden.
 *
 * Software distributed under the GNU Lesser Public License is distributed on an "AS IS" 
 * basis, WITHOUT WARRANTY OF ANY KIND, either express or  implied. Please refer to 
 * the license for the specific language governing your rights and limitations.
 */

package com.ewerp.mud.core.lifecycle;

import com.ewerp.mud.commands.ICommand;
import com.ewerp.mud.core.exceptions.ListenerNotFoundException;
import com.ewerp.mud.core.plugin.IPlugin;

/**
 * {@link ILifecycleProvider} is implemented by the main controller of the
 * ejMud.
 * 
 * @author cboyden
 * 
 */
public interface ILifecycleProvider {

    /**
     * Register an {@link IPlugin} as a listener of the ejMud lifecycle state.
     * 
     * @param listener
     *            A listener for the ejMud lifecycle state <br />
     *            <ul>
     *            <li>{@link ILifecycleListener} : A valid listener implementing
     *            {@link ILifecycleListener}</li>
     *            <li>null : A null value will result in an
     *            {@link IllegalArgumentException}</li>
     *            <ul>
     * 
     *            throws IllegalArgumentException Must be thrown if
     *            {@link ICommand} is null
     */
    public void registerListener(ILifecycleListener listener) throws IllegalArgumentException;

    /**
     * Unregister an {@link IPlugin} as a listener of the ejMud lifecycle state.
     * 
     * @param listener
     *            An existing listener for the ejMud lifecycle state <br />
     *            <ul>
     *            <li>{@link ILifecycleListener} : A valid listener implementing
     *            {@link ILifecycleListener}</li>
     *            <li>null : A null value will result in an
     *            {@link IllegalArgumentException}</li>
     *            <ul>
     * 
     *            throws IllegalArgumentException Must be thrown if
     *            {@link ICommand} is null
     */
    public void unregisterListener(ILifecycleListener listener) throws IllegalArgumentException, ListenerNotFoundException;
}
